package scu.maqiang.numeric;

//import org.netlib.blas.*;
//import org.netlib.lapack.*;

import java.util.Arrays;

/**
 * SimpleDdotTest - example of calling the simplified version of Ddot.
 *
 * To compile and run:
 *
 * bambam> javac -classpath .:f2jutil.jar:blas.jar:blas_simple.jar SimpleDdotTest.java
 * bambam> java -classpath .:f2jutil.jar:blas.jar:blas_simple.jar SimpleDdotTest
 * Answer = 36.3
 *
 **/

public class LAPACK {
//    public static void main(String [] args) {
////        int itype = 1;
////        String jobz = new String("V");
////        String uplo = new String("U");
////        int n = 3;
////        double [][]a = {
////                {1.0, 2.0, 4.0},
////                {0.0, 3.0, 5.0},
////                {0.0, 0.0, 6.0}};
////        int lda = 3;
////        double [][]b = {
////                {2.5298, 0.6405, 0.2091},
////                {0.3798, 2.7833, 0.6808},
////                {0.4611, 0.5678, 2.7942}};
////        int ldb = 3;
////        double []w = new double[n];
////        int lwork = 9;
////        double []work = new double[lwork];
////        org.netlib.util.intW info = new org.netlib.util.intW(0);
////
////        DSYGV.DSYGV(itype, jobz, uplo, n, a, b, w, work, lwork, info);
////
////        System.out.println("on return info = " + info.val);
//        double[][] A = {{2, 1.0, 0}, {0, 3, 0}, {0, 0, 4}};
//        double[] b = {2, 3, 4};
//        double[] x = solveLinearEquation(A, b);
//        System.out.println(MVO.toString(x));
//    }
//
//    public static double inner_product(double[] x, double[] y) {
//        int n = x.length;
//        ParamCheck.checkEqual(n, y.length);
//        return DDOT.DDOT(n, x, 1, y, 1);
//    }
//
//    public static double[] solveLinearEquation(double[][] A, double[] b) {
//        int m = A.length;
//        int n = A[0].length;
//        org.netlib.util.intW info = new org.netlib.util.intW(0);
//
//        ParamCheck.checkEqual(m, n);
//        ParamCheck.checkEqual(n, b.length);
//        int[] myints = new int[m];
//        double[][] rhs = new double[n][1];
//        for(int i = 0; i < n; i++) {
//            rhs[i][0] = b[i];
//        }
//        DGESV.DGESV(m, 1, A, myints, rhs, info);
//        double[] x = new double[n];
//        Arrays.setAll(x, i -> rhs[i][0]);
//        return x;
//    }
}
